<?php

namespace app\admin\command;

use app\common\util\Tools;
use think\console\Input;
use think\console\Output;
use think\facade\Log;

class ArticleTest extends CommonTest
{

    //再命令窗口中执行“php think interface-ArticleTest”
    protected function configure()
    {
        $this->setName('interface-ArticleTest')
            ->setDescription('接口测试');
    }

    public function execute(Input $input, Output $output)
    {
        parent::execute($input, $output);

        //Route::any('admin/articleType/getPageList', 'admin/article/getArticleTypeList');                                        // 文章类型列表，分页功能
//        $data = Tools::curl($this->url . "admin/articleType/getPageList", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

        //Route::any('admin/articleType/create', 'admin/article/toAddArticleType');                                               // 添加文章类型
//        $data = Tools::curl($this->url . "admin/articleType/create", json_encode(["token" => "$this->token", "name" => "机场接送", "icon" => "temp"]));
//        $data = Tools::curl($this->url . "admin/articleType/create", json_encode(["token" => "$this->token", "name" => "固定路线", "icon" => "temp"]));
//        $data = Tools::curl($this->url . "admin/articleType/create", json_encode(["token" => "$this->token", "name" => "专车接送", "icon" => "temp"]));
//        $data = Tools::curl($this->url . "admin/articleType/create", json_encode(["token" => "$this->token", "name" => "其它", "icon" => "temp"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//
//        //Route::any('admin/articleType/getDetailsById', 'admin/article/getArticleTypeDetail');                                   // 文章类型详细信息
//        $data = Tools::curl($this->url . "admin/articleType/getDetailsById", json_encode(["token" => "$this->token", "id" => 1]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

//        //Route::any('admin/articleType/getChoose', 'admin/article/getChooseArticleType');                                        // 挑选出所有的文章类型
//        $data = Tools::curl($this->url . "admin/articleType/getChoose", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

//        //Route::any('admin/article/create', 'admin/article/toAddArticle');                                                       // 添加文章
//        $data = Tools::curl($this->url . "admin/article/create", json_encode(["token" => "$this->token", "title" => "注意啊！！", "typeId" => 1, "content" => "xxxxx"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

//        //Route::any('admin/article/create', 'admin/article/toAddArticle');                                                       // 添加文章
        $data = Tools::curl($this->url . "admin/articleType/articleListById", json_encode(["token" => "$this->token", "id" => "1", "typeId" => 1, "content" => "xxxxx"]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

//        //Route::any('admin/article/getPageList', 'admin/article/getArticleList');                                                // 文章列表，分页功能
//        $data = Tools::curl($this->url . "admin/article/getPageList", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

//        //Route::any('admin/article/getDetailsById', 'admin/article/getArticleDetail');                                           // 文章详细信息
//        $data = Tools::curl($this->url . "admin/article/getDetailsById", json_encode(["token" => "$this->token", "id" => 1]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

    }
}
